<div class="row">
	<div class="col-xs-12">
            <div class="form-group">
                <div class="col-md-3">
                    <div class="input-group">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                        <input type="text" class="form-control" id="nickname" placeholder="根据昵称搜索...">
                    </div>
                </div>
                <div class="col-md-3">
                    <button type="button" onclick="distReload();" class="btn btn-primary">搜索</button>
                </div>
            </div>
            <div class="col-md-12">
                <table id="dist_tab" class="table table-bordered table-striped">
                    <thead>
                    <tr>
                    <tr>
                        <th>昵称</th>
                        <th>头像</th>
                        <th>性别</th>
                        <th>省</th>
                        <th>市</th>
                        <th>积分</th>
                    </tr>
                    </tr>
                    </thead>
                </table>
            </div>
	</div>
</div>


<script type="text/javascript">
var dist_tab;

$(function() {
	//初始化表格
    dist_tab = $('#dist_tab').DataTable({
        "dom":'itflp',
        "processing":true,
        "searching":false,
        "bInfo":false,
        "bServerSide":true,
        "paging":true,
        "bSort":false,
		"language":{"url":"plugins/datatables/language.json"},
		"ajax":{"url":"/admin/wx/fans/distpage","type":"post","data":{"parentFansId":${id},"lv":${lv}}},
		"columns":[
            {"data":"nickname"},
            {"data":"headimgurl"},
            {"data":"sex"},
            {"data":"province"},
            {"data":"city"},
            {"data":"jifenTotal"}
			],
		"columnDefs":[
            {
                targets: 1,
                data: null,
                render: function (data) {
                    if (data.trim() != ''){
                        return '<img src="'+data+'" width="25px" height="auto">';
                    }
                    return '';
                }
            },
            {
                targets: 2,
                data: null,
                render: function (data) {
					if (data == 1 ){
						return "男";
					}
                    if (data == 0 ){
                        return "女";
                    }
					return "未知";
                }
            }
             ]
	}).on('xhr.dt', function ( e, settings, data ,xhr) {
        dataTableMsg(data,xhr);
    } );
});



function distReload(){
    var nickname = $("#nickname").val();
    var param = {
        "parentFansId":${id},
        "lv":${lv},
        "nickname" : nickname
    };
    dist_tab.settings()[0].ajax.data = param;
    dist_tab.ajax.reload();
}


</script>